home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / libsrc~1.z / libsrc~1 / gets.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-12-28  |  308 b   |  17 lines

  1. #include <stdio.h>
  2. #include <assert.h>
  3.     
  4. char *gets(data)
  5. register char *data;
  6. {
  7.     register char *p = data;
  8.     register int c;
  9.     
  10.     assert((data != NULL));
  11.     
  12.     while(((c = getc(stdin)) != EOF) && (c != '\n'))
  13.     *p++ = c;
  14.     *p = '\0';
  15.     return(((c == EOF) && (p == data)) ? NULL : data); 
  16. }
  17.